package com.ruoyi.fts.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.fts.mapper.FtsUserCollectMapper;
import com.ruoyi.fts.domain.FtsUserCollect;
import com.ruoyi.fts.service.IFtsUserCollectService;

/**
 * 用户收藏Service业务层处理
 *
 * @author lumberer
 * @date 2024-10-22
 */
@Service
public class FtsUserCollectServiceImpl extends ServiceImpl<FtsUserCollectMapper, FtsUserCollect> implements IFtsUserCollectService {
    @Autowired
    private FtsUserCollectMapper ftsUserCollectMapper;

    /**
     * 查询用户收藏
     *
     * @param id 用户收藏主键
     * @return 用户收藏
     */
    @Override
    public FtsUserCollect selectFtsUserCollectById(Long id) {
        return ftsUserCollectMapper.selectFtsUserCollectById(id);
    }

    /**
     * 查询用户收藏列表
     *
     * @param ftsUserCollect 用户收藏
     * @return 用户收藏
     */
    @Override
    public List<FtsUserCollect> selectFtsUserCollectList(FtsUserCollect ftsUserCollect) {
        return ftsUserCollectMapper.selectFtsUserCollectList(ftsUserCollect);
    }

    /**
     * 新增用户收藏
     *
     * @param ftsUserCollect 用户收藏
     * @return 结果
     */
    @Override
    public int insertFtsUserCollect(FtsUserCollect ftsUserCollect) {
                ftsUserCollect.setCreateTime(DateUtils.getNowDate());
            return ftsUserCollectMapper.insert(ftsUserCollect);
    }

    /**
     * 修改用户收藏
     *
     * @param ftsUserCollect 用户收藏
     * @return 结果
     */
    @Override
    public int updateFtsUserCollect(FtsUserCollect ftsUserCollect) {
        return ftsUserCollectMapper.updateById(ftsUserCollect);
    }

    /**
     * 批量删除用户收藏
     *
     * @param ids 需要删除的用户收藏主键
     * @return 结果
     */
    @Override
    public int deleteFtsUserCollectByIds(Long[] ids) {
        return ftsUserCollectMapper.deleteFtsUserCollectByIds(ids);
    }

    /**
     * 删除用户收藏信息
     *
     * @param id 用户收藏主键
     * @return 结果
     */
    @Override
    public int deleteFtsUserCollectById(Long id) {
        return ftsUserCollectMapper.deleteFtsUserCollectById(id);
    }
}